import requests
from lxml import etree
if __name__ == '__main__':
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
    }
    url = 'https://blog.csdn.net/qq_35208583/article/details/89041912'
    response = requests.get(url=url,headers=headers).text
    ## 格式化
    html = etree.HTML(response)
    ## 属性定位，取属性
    content = html.xpath('//meta[@name="description"]/@content')
    for i in content:
        print(i)